package jk.spider.core.task.work;

import jk.spider.core.SpiderController;
import jk.spider.core.event.CoreEvent;
import jk.spider.core.task.WorkerTask;
import jk.spider.model.Resource;

public abstract class BaseWorkerTaskImpl implements WorkerTask {
	protected SpiderController controller;
	protected int workType;
	
	public BaseWorkerTaskImpl(SpiderController controller, int workType) {
		this.controller = controller;
		this.workType = workType;
	}
	
	public int getType() {
		return this.workType;
	}
	
	protected synchronized void notifyEvent(Resource resource, CoreEvent event) {
        if ( event == null ) {
        } else {
        	controller.getContent().registerEvent(resource, event);
        }
    }
}
